package Z09Swing.ZUJian;

import javax.swing.*;
import java.awt.*;

/**
 * @author 李某
 * * @date 2021/10/21
 * *物有本末，事有终始。知其先后者，则近道矣！
 * *荷花开满池塘的前一天还是半塘荷花半塘云。
 */
public class Z10密码框 {}

class Test10{
    public static void main(String[] args) {
        JFrame f = new JFrame();
        f.setSize(400,300);
        f.setLocation(200,200);

        f.setLayout(new FlowLayout());

        JLabel l = new JLabel("密码：");

        JPasswordField pf = new JPasswordField("");
        pf.setText("&48kdh4@#");
        pf.setPreferredSize( new Dimension(80,30));

        char[] passworld = pf.getPassword();
        String p = String.valueOf(passworld);
        System.out.println(p);

        f.add(l);
        f.add(pf);

        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        f.setVisible(true);
    }
}
